# Contributor: Raed Rizqie <raed.rizqie@gmail.com>

_realname=qstylizer
pkgbase=mingw-w64-python-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-python-${_realname}
pkgver=0.2.2
pkgrel=3
pkgdesc='Qt stylesheet generation utility for PyQt/PySide (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64' 'clang32')
license=('MIT')
url='https://github.com/blambright/qstylizer'
depends=(
    ${MINGW_PACKAGE_PREFIX}-python
    ${MINGW_PACKAGE_PREFIX}-python-inflection
    ${MINGW_PACKAGE_PREFIX}-python-jupyter_core
    ${MINGW_PACKAGE_PREFIX}-python-pyqt5
    ${MINGW_PACKAGE_PREFIX}-python-pywin32
    ${MINGW_PACKAGE_PREFIX}-python-tinycss2
)
makedepends=(
    ${MINGW_PACKAGE_PREFIX}-python-setuptools
    ${MINGW_PACKAGE_PREFIX}-python-wheel
    ${MINGW_PACKAGE_PREFIX}-python-pbr
)
source=("https://github.com/blambright/${_realname}/archive/${pkgver}.tar.gz")
sha256sums=('95f7666929cc34efbbd9e0640a13f507b8ec35ec34a9604017cf96c24f7f9ea6')

prepare() {
  rm -rf python-build-${MSYSTEM} | true
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}"

  export PBR_VERSION=${pkgver}
}

build() {
  msg "Python build for ${MSYSTEM}"
  cd "${srcdir}/python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE.txt"
}
